package com.wxg.jfinal.util;

import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Table;
import com.jfinal.plugin.activerecord.TableMapping;
import com.jfinal.plugin.c3p0.C3p0Plugin;
import com.wxg.domain.englishword._MappingKit;

public class JFinalUtils {

	/**
	 * 
	 * 非Web环境下调用
	 * 
	 */
	public static void startNonWeb(){
//		DruidPlugin dp = new DruidPlugin();
		C3p0Plugin cp = JFinalGenUtils.getC3p0Plugin();
		ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
		_MappingKit.mapping(arp);
		
		cp.start();
		arp.start();
	}
	
	/**
	 * 获取"Table"
	 * @param modelClass
	 * @return
	 */
	public static Table getTable(@SuppressWarnings("rawtypes") Class<? extends Model> modelClass){
		Table table = TableMapping.me().getTable(modelClass);
		return table;
	}
	
}
